//
//  DemoViewController.m
//  VirtualViewDemo
//
//  Created by xiaerfei on 2018/12/29.
//  Copyright © 2018 tmall. All rights reserved.
//

#import "DemoViewController.h"
#import <VirtualView/VVViewContainer.h>
#import <VirtualView/VVTemplateManager.h>
#import <VirtualView/VVViewFactory.h>

@interface DemoViewController ()

@end

@implementation DemoViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    // Uncomment the following line to preserve selection between presentations.
    // self.clearsSelectionOnViewWillAppear = NO;
    
    // Uncomment the following line to display an Edit button in the navigation bar for this view controller.
    // self.navigationItem.rightBarButtonItem = self.editButtonItem;
}

#pragma mark - Table view data source

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return 0;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return 0;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell"];
    if (!cell) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"cell"];
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
        VVViewContainer *container = [VVViewContainer viewContainerWithTemplateType:@"TextCell" alwaysRefresh:NO];
        container.tag = 1000;
        [cell addSubview:container];
    }
    VVViewContainer *container = [cell viewWithTag:1000];
    if (container) {
        CGFloat viewWidth = CGRectGetWidth(self.view.bounds);
        CGFloat height = [self tableView:tableView heightForRowAtIndexPath:indexPath];
        container.frame = CGRectMake(0, 0, viewWidth, height);
//        [container update:[_dataArray objectAtIndex:indexPath.row]];
    }
    return cell;
    
    return cell;
}




@end
